package com.AAA.service.Impl.sds;

import com.AAA.entity.MyPage;
import com.AAA.entity.sds.TSdsRecord;
import com.AAA.entity.sds.TSdsRecordjieguo;
import com.AAA.entity.sds.TSdsRecordren;
import com.AAA.service.sds.TSdsRecordService;
import com.AAA.dao.sds.TSdsRecordMapper;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * (TSdsRecord)表服务实现类
 *
 * @author makejava
 * @since 2022-10-29 15:20:05
 */
@Service
public class TSdsRecordServiceImpl implements TSdsRecordService {
   @Autowired
   private TSdsRecordMapper mapper;
   //
   @Override
   public TSdsRecord checkRecord(TSdsRecord record) {
      TSdsRecord tSdsRecord = mapper.selectOne(record);
      return tSdsRecord;
   }

   @Override
   public int insertRecord(TSdsRecord record) {
      record.setCreatetime(new Date());
      int i = mapper.insert(record);
      System.out.println(record.getId());
      return record.getId();
   }

   @Override
   public PageInfo getall(MyPage myPage, TSdsRecord record) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      List<TSdsRecord> select = mapper.queryall(record);
      PageInfo pageInfo = new PageInfo<>(select);
      return pageInfo;
   }

   @Override
   public PageInfo getDetailMsg(MyPage myPage, Integer id) {

         PageHelper.startPage(myPage.getPage(), myPage.getLimit());
         List<Map<String,Object>> details = mapper.getDetails(id);
         PageInfo pageInfo = new PageInfo(details);
         return pageInfo;

   }

   @Override
   public PageInfo selectcore(MyPage myPage, TSdsRecordjieguo record) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      List<TSdsRecordjieguo> select = mapper.selectjiguo(record);
      PageInfo pageInfo = new PageInfo<>(select);
      return pageInfo;
   }


   @Override
   public PageInfo selectren(MyPage myPage, TSdsRecordren record) {
      PageHelper.startPage(myPage.getPage(), myPage.getLimit());
      List<TSdsRecordren> select = mapper.selectren(record);
      PageInfo pageInfo = new PageInfo<>(select);
      return pageInfo;
   }
}
